import instance from '@/utils/request'
export const userRegistryService = ({ username, password, repassword }) =>
  instance.post('/api/reg', { username, password, repassword })

export const userLoginService = (username, password) =>
  instance.post('/api/login', { username, password })

export const useGetInfoService = () => instance.get('/my/userinfo')

export const userUpdateInfoService = ({ id, username, email, nickname }) =>
  instance.put('/my/userinfo', { id, username, email, nickname })

export const userUpdateAvatarService = (avatar) =>
  instance.patch('/my/update/avatar', { avatar })

export const userUpdatePwdService = (data) =>
  instance.patch('/my/updatepwd', data)
